package com.dazzle.system.service.impl;

import javax.annotation.Resource;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import com.dazzle.core.service.impl.GenericServiceImpl;
import com.dazzle.system.dao.SysUserDao;
import com.dazzle.system.entity.SysUser;
import com.dazzle.system.service.SysUserService;

public class SysUserServiceImpl extends GenericServiceImpl<SysUser,Long> implements SysUserService,UserDetailsService{

	@Resource
	private SysUserDao dao ;

	public SysUserServiceImpl(SysUserDao sysUserDao) {
		super(sysUserDao);
		this.dao = sysUserDao;
	}
	
	public SysUser getUserByUserName(String userName) {
		return dao.getUserByUserName(userName);
	}

	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		return dao.getUserByUserName(username);
	}
}